package cn.wolfcode.wolf2w.note.api.domain;

import java.util.Date;

import cn.wolfcode.wolf2w.member.api.domain.UserInfo;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import cn.wolfcode.wolf2w.common.core.annotation.Excel;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

import java.io.Serializable;

/**
 * 旅游日记对象 ta_note
 *
 * @author dafei
 * @date 2023-06-17
 */
@Setter
@Getter
@Accessors(chain = true)
@TableName("ta_note")
public class Note implements Serializable {
    private static final long serialVersionUID = 1L;

    public static final int PUBLIC_NO = 0;
    public static final int PUBLIC_YES = 1;


    public static final int STATE_NORMAL = 0;  //草稿
    public static final int STATE_WAITING = 1;  //待发布(待审核)
    public static final int STATE_RELEASE = 2;  //审核通过
    public static final int STATE_REJECT = 3;  //拒绝



    /** 主键 */
    @TableId(type = IdType.AUTO)
    private Long id;

    /** 目的地id */
    private Long destId;

    /** 目的地 */
    @Excel(name = "目的地")
    private String destName;

    /** 作者id */
    @Excel(name = "作者id")
    private Long authorId;

    @TableField(exist = false)
    private UserInfo author;

    /** 标题 */
    @Excel(name = "标题")
    private String title;

    /** 概要 */
    private String summary;

    /** 封面 */
    @Excel(name = "封面")
    private String coverUrl;

    /** 旅游时间 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "旅游时间", width = 30, dateFormat = "yyyy-MM-dd")
    private Date travelTime;

    /** 人均消费 */
    @Excel(name = "人均消费")
    private Long avgConsume;

    /** 旅游天数 */
    @Excel(name = "旅游天数")
    private Long days;

    /** 和谁旅游 */
    @Excel(name = "和谁旅游")
    private Integer person;

    /** 发布时间 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "发布时间", width = 30, dateFormat = "yyyy-MM-dd")
    private Date releaseTime;

    /** 是否公开 0:否 1:是 */
    @Excel(name = "是否公开 0:否 1:是")
    private Integer isPublic = PUBLIC_NO;

    /** 点击/阅读数 */
    @Excel(name = "点击/阅读数")
    private Integer viewnum;

    /** 回复数 */
    @Excel(name = "回复数")
    private Integer replynum;

    /** 收藏数 */
    @Excel(name = "收藏数")
    private Integer favornum;

    /** 分享数 */
    @Excel(name = "分享数")
    private Integer sharenum;

    /** 点赞数 */
    @Excel(name = "点赞数")
    private Integer thumbsupnum;

    /** 状态  */
    @Excel(name = "状态 ")
    private Integer status = STATE_NORMAL;

    @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd")
    private Date createTime;
    @Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd")
    private Date updateTime;


    @TableField(exist = false)
    private NoteContent content;

    public String getStatusDisplay() {
        if(status!=null){
            if (  status == STATE_NORMAL) {
                return "编辑中";
            } else if (status == STATE_WAITING) {
                return "待发布";
            } else if (status == STATE_RELEASE) {
                return "已发布";
            } else if (status == STATE_REJECT) {
                return "已拒绝";
            }
        }
        return "";
    }
    public String getPersonDisplay() {

        if (person == null) {
            return "其他";
        }

        if (person == 1) {
            return "一个人";
        } else if (person == 2) {
            return "情侣/夫妻";
        } else if (person == 3) {
            return "带孩子";
        } else if (person == 4) {
            return "家庭出游";
        } else if (person == 5) {
            return "和朋友";
        } else if (person == 6) {
            return "和同学";
        } else if (person == 7) {
            return "其它";
        }
        return "其它";
    }












}
